home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / M / MCASSEMDOC < prev    next >
Encoding:
Text File  |  1987-04-04  |  57.3 KB  |  1,519 lines  |  [TEXT/MACA]

  1. **************************************************************************
  2.  
  3.         McAssembly™ V6.5 Shareware Docs 
  4.         Copyright © 1986,87 By Signature Software
  5.  
  6. **************************************************************************
  7. (This document is layed out for Monaco 9, with tabs set to eight spaces.)
  8.  
  9. **************************************************************************
  10.             CHANGES IN VERSION 6.5
  11. **************************************************************************
  12.  
  13. * BASE can now be used with no symbol operands to specify a base register
  14.     for all subsequent labels. ENDB is used to turn off such basing.
  15. * DSEC can now have an optional address register operand which causes all
  16.     labels in the dsec to be based to the specified register.
  17. * DEND can now have an optional symbol operand which will be set to the
  18.     size of the dsec. (Similar to the same capabilities on the ENDP
  19.     and ENDL pseudo-ops.)
  20.  
  21. **************************************************************************
  22.             CHANGES IN VERSION 6.4
  23. **************************************************************************
  24.  
  25. * User-definable linker .MAP file formats may now be created - see the section
  26.     on user-definable maps for details.
  27. * Fixed a bug which sometimes caused a hang when the output window was resized.
  28. * Added the IFLIST pseudo-op to the assembler which allows unassembled
  29.     conditional assembly clauses to be listing suppressed.
  30. * Fixed a bug in the assembler - MOVEQ with an operand in the range of
  31.     +128...+255 will now cause an error.
  32. * Fixed a bug in the assembler - operands of the form exp8(Dn) where exp8 is in
  33.     the range [+128...+255] or [-129...-256] will now cause an error.
  34. * Fixed a bug in the linker - word offsets in the range [+32768...+65535] or
  35.     [-32769...-65536] are now reported as errors.
  36. * In the linker, if an error occurs, the program counter where the error
  37.     occurred is shown in the error message where applicable.
  38. * McAssembly now obtains the creator signatures for all TEXT files that it
  39.     creates from a STR,128 resource.
  40. * A printer initialization string may now be stored in a STR,129 resource.
  41.  
  42. **************************************************************************
  43.             CHANGES IN VERSION 6.3
  44. **************************************************************************
  45.  
  46. * Added the DEFALL pseudo-op to the assembler.
  47. * Added the ERROR pseudo-op to the assembler.
  48. * Fixed a bug in the assembler - MOVEM instructions with PC-relative operands
  49.     now assemble correctly.
  50.  
  51. **************************************************************************
  52.             CHANGES IN VERSION 6.2
  53. **************************************************************************
  54.  
  55. * Single quotes are now allowed as string delimiters.
  56. * Macro parameters can now be picked off as substrings by &n[start:length].
  57. * New string escape codes: /', /D, /S, /U, /A.
  58. * New pseudo-op DEFINE allows the use of string variables for string
  59.     replacements in the source line before assembly.
  60. * << and >> are now accepted for SHL and SHR.
  61. * ALIGN now accepts an operand and may be coded as .ALIGN.
  62. * New pseudo-ops INCLUDE, OPWORD, and ENDIF are the same as INCL, TRAPW, and
  63.     ENDI, respectively.
  64. * Assembly error lines may now be copied to the clipboard.
  65.  
  66. **************************************************************************
  67.             INTRODUCTION
  68. **************************************************************************
  69.  
  70.     This document briefly describes the McAssembly program - an assembler, 
  71. resource compiler, linker, and job controller for the Macintosh. McAssembly is 
  72. a shareware program - if you like it and use it, then please register it by 
  73. sending $40.00 to:
  74.  
  75.     Signature Software (checks payable to same)
  76.     2151 Brown Ave.
  77.     Bensalem, PA 19020        (215) 639-8764
  78.  
  79. All registered owners will receive the following:
  80.     • a 94-page manual
  81.     • the latest version of the program
  82.     • Apple's EDIT editor
  83.     • a symbolic debugger called McBug
  84.     • several example working applications source code files
  85.     • all of the standard Apple equate, trap, and .rel files in McAssembly
  86.         format
  87.     • a utility to convert McAssembly .rel files to MDS .rel files
  88.     • 24-hour, 7-day telephone support
  89.     (Supplied on an 800K HFS diskette unless otherwise requested.)
  90.  
  91.     I strongly recommend that you register it if you use it, just for the 
  92. additional examples and manual alone. (This document must of necessity be very 
  93. brief - the manual goes into much greater detail. The MacWrite manual files are 
  94. over 200K, which I thought was too much to expect people to download, so I've 
  95. condensed them into this text file.)
  96.  
  97.     To those of you who might object that this isn't a complete package 
  98. because I've not distributed everything that you should have (particularly the 
  99. system equate files and examples), I answer as follows:
  100.  
  101.     • The whole package takes up almost 800K of disk space - I can't 
  102. imagine anyone seriously wanting to download that! The $40.00 registration fee 
  103. is probably a wash when you consider the download charges, the time to download 
  104. and print the docs, and the aggravation. The documentation presented here, 
  105. while condensed, does represent all of the essential information that you need 
  106. to know to use the program, it's just a lot easier if you have the whole 
  107. package. In addition, don't forget that the whole package is a complete 
  108. assembly language development system. Something as complex as that hardly lends 
  109. itself to electronic distribution. In fact, I think I've done a masterful job 
  110. just in getting all of the information you need to use it in only this 50K 
  111. file.
  112.  
  113.     • Parts of the package are copyright by Apple Computer, and I can't 
  114. distribute them indiscriminately. I can supply them to registerees under the 
  115. terms of my license with Apple.
  116.  
  117.     • If you're an experienced Mac assembly language programmer, then the 
  118. information presented here is probably more than enough to get you going. If 
  119. you're converting from some other assembler to McAssembly, you may not even 
  120. need the whole package (although I would still expect you to register.) If 
  121. you're an inexperienced Mac programmer, then the examples in the registered 
  122. package, the system files, and my telephone support would probably be of value 
  123. to you, but I don't see how anyone could object to paying for those.
  124.  
  125.     • Given the current registration ratios of other Macintosh shareware 
  126. programs, what's wrong with having a little incentive to register?
  127.  
  128.  
  129.                 ____________________________________
  130.                 |                   |
  131.                 |  Dave McWherter    12/01/86   |
  132.                 |                                  |
  133.                 |  Compuserve 70057,1612           |
  134.                 |  Delphi     DMcWherter           |
  135.                 |  Genie      D.McWherter          |
  136.                 |__________________________________|
  137.  
  138.  
  139. **************************************************************************
  140.             THE MENU SELECTIONS
  141. **************************************************************************
  142.  
  143.     First, a description of the menu options:
  144.  
  145.     File menu:
  146.         Assemble    assembles a file
  147.         Link        links a group of files
  148.         Run job        executes a .job file
  149.         Save options    save current McAssembly options
  150.         Quit        what else?
  151.  
  152.     Assembler menu:
  153.         Object file        creates a .rel object file
  154.         Listing to printer    echoes output to printer
  155.         Listing to screen    echoes output to screen
  156.         Listing to file        echoes output to .lst file
  157.         Errors only listing    only outputs error lines
  158.         Symbol table        outputs symbol table at end
  159.         Cross reference        outputs cross reference table at end
  160.         Terse cref mode        removes unref'ed .PSM symbols from     
  161.                     cross reference list
  162.         .PSM file        creates a .PSM file
  163.         DEF all symbols        DEFs all non-.PSM symbols in the file
  164.         No listing headers    suppresses headers in listings
  165.         MPW object format    object file will be in MPW format, .o
  166.         Error lines to clip    copies error lines to clipboard
  167.  
  168.     Linker menu:
  169.         Symbol table        outputs symbol table at end
  170.         .MAP file output    echoes output to .map file
  171.         Printer output        echoes output to printer
  172.         McBug .SYM file        creates symbol file for use with McBug
  173.         Raw code data file    puts output code in data fork of file
  174.                         with no resource formatting
  175.         User .MAP file        creates a .map file in a user-defined
  176.                         format
  177.  
  178.     Jobs menu:
  179.         Stop if Asm error    stop the job if assembly error occurs
  180.         No link if Asm error    don't link if assembly error occurs
  181.         Force assemblies    force all files in job to be assembled
  182.  
  183.     Misc. menu:
  184.         Enable Beep        enable beep at end of commands
  185.         Use .Print driver    route printer output through the driver
  186.                     (else goes directly to serial port B)
  187.  
  188.     Transfer menu:
  189.         EDIT            to EDIT program
  190.         QUED            to QUED program
  191.         MDS Convert        to MDS Convert program
  192.         Other            to any other program
  193.  
  194. **************************************************************************
  195.             SOURCE LINE FORMAT
  196. **************************************************************************
  197.  
  198.     All source code lines must be in the following form:
  199.  
  200.     [label]    opcode    [operand]    [;] [comment]
  201.  
  202.     Tabs or spaces separate fields, and >>> only one tab (or space) can 
  203. appear between the opcode field and the operand field <<<. Labels may contain 
  204. up to 100 characters, all of which are significant. Labels may contain 
  205. alphanumeric characters and any of the following characters: _, %, !, @, #, $, 
  206. ?, or period. Labels may be suffixed with a colon if desired.
  207.  
  208.     The semicolon comment designator character is optional in the majority 
  209. of cases. Specifically, if an opcode appears in the line then you can omit the 
  210. semicolon. If a line contains just a label and a comment, then you have to use 
  211. the semicolon.
  212.  
  213. **************************************************************************
  214.             ARITHMETIC EXPRESSIONS
  215. **************************************************************************
  216.  
  217.     All arithmetic and logical operations are 32-bit operations. McAssembly 
  218. supports the following operators and special characters.
  219.  
  220.     +    integer addition
  221.     -    integer subtraction
  222.     /    integer division (32 bits/32 bits = 32 bits)
  223.     *    integer multiplication (32 bits * 32 bits = 32 bits)
  224.     MOD    integer modulus
  225.     SHL    logical shift left (16 SHL 2 = 64)
  226.     <<    same as SHL
  227.     SHR    logical shift right (16 SHR 3 = 2)
  228.     >>    same as SHR
  229.     AND    logical bit AND
  230.     OR    logical bit OR
  231.     XOR    logical bit eXclusive-OR
  232.     NOT    logical bit inverse
  233.     'xxxx'    character constant (1-4 characters, right justified)
  234.     *    current value of program counter
  235.     $    specifies a hexadecimal number
  236.     %    specifies a binary number
  237.  
  238.         (The following relational operators return true or false;
  239.          true = $FFFFFFFF and false = 0.)
  240.  
  241.     <=    less than or equal
  242.     <>    not equal
  243.     >=    greater than or equal
  244.     <    less than
  245.     >    greater than
  246.     =    equal to
  247.  
  248.     The expression processor uses standard algebraic precedence rules. Use 
  249. parentheses to force precedence.
  250.  
  251. **************************************************************************
  252.             ALIGNMENT
  253. **************************************************************************
  254.  
  255.     McAssembly automatically aligns those things that must be on an even 
  256. address (opcodes, variable or constant words and longs, trap words, etc.) by 
  257. putting a zero byte in front of them if necessary. However, labels on 
  258. automatically aligned lines still carry the value of the address before the 
  259. alignment. These may be odd. If this happens, McAssembly warns you with a LABEL 
  260. ON ODD ADDRESS message. If that's what you really wanted, then you can ignore 
  261. the warning. Otherwise, you must change the code accordingly, probably by 
  262. adding an explicit ALIGN pseudo-op, and reassemble.
  263.  
  264. **************************************************************************
  265.             THE ASSEMBLER PSEUDO-OPS
  266. **************************************************************************
  267.  
  268.     (These are almost in alphabetical order. In some cases, pseudo-ops 
  269. which are used together are grouped together for description purposes.)
  270.  
  271.  
  272. A5OFF    <absolute expr>            specify initial A5 offset
  273. A5SEC                    define A5 offset variables
  274. A5END                    end an A5SEC
  275. A5REF    <symbol> [, <symbol>, ...]    reference an A5SEC variable
  276.  
  277. All global data which is to be stored offset from A5 must be defined between 
  278. A5SEC and A5END. You can have as many A5SEC's in a file as you want - the 
  279. linker concatenates them. A5OFF may be used to specify the initial offset below 
  280. A5 for all of your globals, and defaults to $100. A5REF is used to reference A5 
  281. variables which are defined in other modules. Symbols which are defined as A5 
  282. variables don't have to have the '(A5)' suffixed to them. For example:
  283.  
  284.         a5off    grafSize
  285.         a5sec
  286.     global1    ds.l    1
  287.     global2    ds.w    2
  288.         a5end
  289.         a5ref    external
  290.  
  291.         move    global1,d0    this is the same as...
  292.         move    global1(a5),d0        this
  293.         move    external,d0    and this is the same as...
  294.         move    external(a5),d0        this
  295.  
  296. ALIGN    [<expr>]    aligns the PC to a multiple of <expr>, default = 2
  297. .ALIGN    [<expr>]    aligns the PC to a multiple of <expr>, default = 2
  298.  
  299. BASE    An, <symbol> [,<symbol>, ...]    auto-offsets specified symbols by An
  300. BASE specifies that a symbol is to be offset by the specified address register 
  301. every time you use it For example, if you do this:
  302.  
  303.         base    a6,sym1,sym2
  304.         move    sym1,d0            then this instruction
  305.         move    sym1(a6),d0        is the same as this one and
  306.         move    sym1(a3),d0        you can override it if you want
  307.  
  308. BASE    An        auto-offset all subsequently defined symbols by An
  309. ENDB            turn off symbol basing (only necessary if no symbols
  310.                 are specified in the BASE operand list)
  311.  
  312. CASE    turns on case sensitivity
  313.  
  314. If you don't use CASE, then case in labels is not significant.
  315.  
  316.  
  317. DB    <expr> [, <expr>, ...]    define constant bytes at the PC
  318. DC    <expr> [, <expr>, ...]    define constant words at the PC
  319. DC.B    <expr> [, <expr>, ...]    define constant bytes at the PC
  320. DC.L    <expr> [, <expr>, ...]    define constant longs at the PC
  321. DC.W    <expr> [, <expr>, ...]    define constant words at the PC
  322. DL     <expr> [, <expr>, ...]    define constant longs at the PC
  323. DW     <expr> [, <expr>, ...]    define constant words at the PC
  324.  
  325. DCB     <count>, <value>    define block of <count> bytes of <value>
  326. DCB.B    <count>, <value>    define block of <count> bytes of <value>
  327. DCB.L     <count>, <value>    define block of <count> longs of <value>
  328. DCB.W     <count>, <value>    define block of <count> words of <value>
  329. FILL     <count>, <value>    equivalent to DCB
  330.  
  331. DEF     <symbol> [, <symbol>, ...]    externally define symbols
  332. XDEF     <symbol> [, <symbol>, ...]    externally define symbols
  333.  
  334. DEF and XDEF are equivalent - they allow symbols in this file to be referenced 
  335. from another file.
  336.  
  337. DEFALL
  338.  
  339. Same as DEF'ing every symbol in the file.
  340.  
  341. DEFINE    "string"        define a string symbol; the symbol may then be
  342.                     used anywhere in a source line between
  343.                     curly brackets and will cause a string
  344.                     replacement before the line is
  345.                     assembled. For example:
  346.  
  347.     hello    define    "goodbye"    if you define hello to be 'goodbye'
  348.         text    "* {hello} *"    then this string will be '* goodbye *'
  349.  
  350. DSEC     <absolute expr> [<An]    start dummy section, org'ed at <absolute expr>,
  351.                     base all labels inside to An
  352.  
  353. DSEC    [<symbol>]        end a DSEC, symbol is set to size of the DSEC
  354.  
  355. RSEC    [An]            begin reverse DSEC, org'ed at 0, and BASE     
  356.                 symbols inside to An (default A6)
  357. ENDR    [<symbol>]        end an RSEC, symbol set to size of the section
  358.  
  359.  
  360. DSEC and DEND delimit "dummy sections", which may contain only storage 
  361. allocation statements. No storage is actually allocated for items in a dummy 
  362. section - their primary use is to assign values to record structures. Only 
  363. storage allocation statements are allowed in dummy sections. For example:
  364.  
  365.         dsec    1
  366.     sym1    ds.b    1    will have a value of 1
  367.     sym2    ds.w    1    will have a value of 2
  368.     sym3    ds.l    1    will have a value of 4
  369.         dend
  370.  
  371. Dummy sections may also be defined in 'reverse' using RSEC, for example:
  372.  
  373.         rsec
  374.     sym1    ds    0    will have a value of  0
  375.     sym2    ds.w    1    will have a value of -2
  376.     sym3    ds.l    1    will have a value of -6
  377.     sym4    ds.w    1    will have a value of -8
  378.         endr    rsize    rsize will have a value of 8
  379.  
  380. DS     <count>        define <count> words of storage at PC
  381. DS.B    <count>        define <count> bytes of storage at PC
  382. DS.L     <count>        define <count> longs of storage at PC
  383. DS.W     <count>        define <count> words of storage at PC
  384.  
  385. BOOLEAN    <count>        same as ds.w (These allow more mnemonic DS's...)
  386. BYTE    <count>        same as ds.b    "    "    "    "
  387. CHAR    <count>        same as ds.w    "    "    "    "
  388. HANDLE    <count>        same as ds.l    "    "    "    "
  389. HDL    <count>        same as ds.l    "    "    "    "
  390. INTEGER    <count>        same as ds.w    "    "    "    "
  391. LONG    <count>        same as ds.l    "    "    "    "
  392. LONGINT    <count>        same as ds.l    "    "    "    "
  393. POINT    <count>        same as ds.l    "    "    "    "
  394. POINTER    <count>        same as ds.l    "    "    "    "
  395. PTR    <count>        same as ds.l    "    "    "    "
  396. RECT    <count>        same as ds.b  8*<count>
  397. VAR    <count>        same as ds.l    "    "    "    "
  398. WORD    <count>        same as ds.w    "    "    "    "
  399.  
  400.  
  401. IF     <absolute expr>        conditional assembly
  402. ELSE                used with IF
  403. ENDI                end an IF clause
  404. ENDIF                end an IF clause
  405. IFDEF    <symbol>        true if symbol defined
  406. IFNDEF    <symbol>        true if symbol undefined
  407. IF1                true if pass 1
  408. IF2                true if pass 2
  409.  
  410. Conditional assembly control. For example:
  411.  
  412.         if    0    the expr is not true, so
  413.         <statements>        these statements aren't assembled
  414.         else                (else clauses are optional)
  415.         <statements>        but these statements are
  416.         endi
  417.  
  418. IFLIST    <expr>            conditional listing control
  419.  
  420. If the expression is true (the default condition), then conditional assembly 
  421. clauses which aren't assembled will appear in the listing, otherwise they 
  422. won't.
  423.  
  424. END        end of program (optional)
  425.  
  426. EQU    <expr>        equate symbol to <expr>
  427. EQU.B    <expr>        equate symbol to <expr>    (equivalent to equ)
  428. EQU.W    <expr>        equate symbol to <expr>    (equivalent to equ)
  429. EQU.L    <expr>        equate symbol to <expr>    (equivalent to equ)
  430.  
  431. ERROR    "your error message"
  432.  
  433. Allows user-definable assembly errors.
  434.  
  435. FSIGN     <absolute expr>        specify program's Finder file signature
  436. FTYPE     <absolute expr>        specify program's Finder file type
  437.  
  438. For example, if you're assembling an application, then:
  439.  
  440.         ftype    'APPL'
  441.         fsign    'ursg'
  442.  
  443. Or, if you're assembling a desk accessory to be installed by the Font/DA Mover:
  444.  
  445.         ftype    'DFIL'
  446.         fsign    'DMOV'
  447.  
  448. IPATH    "pathname"    specify an HFS path to subsequent include files
  449. INCL    "filename"    include another source file
  450. INCLUDE    "filename"    include another source file
  451.  
  452. JTBL       <symbol> [, <symbol>, ...]    specify jump table entries
  453.  
  454. Any symbol that's referenced from another segment by a Bcc, DBcc, JSR, JMP, 
  455. LEA, or PEA instruction >>> must <<< be specified as a jump table entry.
  456.  
  457. LINE    [ <char> [ , <count> ] ]    prettyprint a line of chars
  458.  
  459. Outputs a listing line filled with the specified number of characters. <count> 
  460. defaults to 50, and <char> defaults to '*'.
  461.  
  462. LIST    <absolute expr>        listing control
  463.  
  464. If the expression is true (not 0), then subsequent source lines appear in the 
  465. listing, otherwise they won't.
  466.  
  467.  
  468. LFRAME    [An]        begin local variable stack frame, and BASE symbols     
  469.             inside to An (default A6)
  470. ENDL    [<symbol>]    end a LFRAME, symbol is set to size of the frame
  471.  
  472. LFRAME and ENDL allow local variables which are to be stored on the stack to be 
  473. easily defined. Symbols defined within the frame are automatically BASE'd to 
  474. the specified register so that you don't have to suffix them with '(An)'. For 
  475. example:
  476.  
  477.         lframe
  478.     local1    integer        will have an a6 offset of -2
  479.     local2    longint        will have an a6 offset of -6
  480.     local3    rect        will have an a6 offset of -14
  481.         endl    lsize    will have a value of 14
  482.  
  483.     Subroutine_Entry
  484.         link    a6,#-lsize    save stack space for locals
  485.         move    local1,d0    this instruction is the same as...
  486.         move    -2(a6),d0        this one
  487.         ...
  488.         unlk    a6        clear locals from stack
  489.         rts            return
  490.  
  491.  
  492. LOC            start new local scope block
  493. LOCSYM    <expr>        change local label character
  494. NOLOC            auto-LOC on non-local labels
  495.  
  496. Local symbols begin with a period and may contain the same cast of characters 
  497. as normal labels. Their scope normally extends from one LOC statement to the 
  498. next LOC statement. This can be changed with the NOLOC statement, which causes 
  499. local symbol scopes to extend from one non-local label to the next non-local 
  500. label. The local symbol prefix character can be changed with the LOCSYM 
  501. statement. For example,
  502.  
  503.             loc
  504.         .hello    nop        this .hello
  505.             loc
  506.         .hello    nop        is different than this .hello
  507.         .hello    nop        but this .hello causes an error
  508.  
  509. Or, using NOLOC, and LOCSYM (for MDS compatibility):
  510.  
  511.             noloc
  512.             locsym    '@'
  513.         goodbye    nop
  514.         @hello    nop        this @hello
  515.         solong    nop
  516.         @hello    nop        is different than this @hello
  517.         @hello    nop        but this @hello causes an error
  518.  
  519.  
  520. MACRO    [&1,&2,...,&F]        begin a macro definition
  521. MACROX    [&1,&2,...,&F]        ditto, no auto LOC on call
  522. ENDM                end a macro definition
  523. MEXP     <absolute expr>        macro expansion control
  524.  
  525. These control macros. For example, given a macro called test defined as:
  526.  
  527.         test    macro    &1,&2,&3,&4,&5,&6
  528.             move    &1,d0
  529.             lea    &2,a0
  530.             if    &&3 = "hello"
  531.             nop
  532.             endi
  533.             text    &&4        notice quote enclosure
  534.         lab%5    nop            notice expand as value string
  535.             &6            parameters may be opcodes
  536.             text    "&2[2:3]    param substring [start:length]
  537.             endm
  538.  
  539. And a call to test like this:
  540.  
  541.         num    equ    1234
  542.             test    d2,symbol,hello,mikey,num,_Open
  543.  
  544. Then it would be expanded to the following:
  545.  
  546.             move    d2,d0
  547.             lea    symbol,a0
  548.             nop
  549.             text    "mikey"
  550.         lab1234    nop
  551.             _Open
  552.             text    "ymb"
  553.  
  554. MACROs do an automatic LOC on entry so that local symbols inside the macro have 
  555. their own scope. This prevents local symbols inside the macro from conflicting 
  556. with local symbols outside it. MACROX's do not do the LOC - so that you can 
  557. pass local symbols to a macro if you want. MEXP controls whether or not macro 
  558. expansions appear in the listing: they will appear if the expression is true.
  559.  
  560.  
  561. NAME    <symbol>    specifies the module name (one source file is a module)
  562.  
  563. PAGE    ["title"]    page eject, optionally specifying a page title
  564.  
  565. PFRAME    [An]        begin parameter stack frame, and BASE symbols inside to 
  566.                 An (default A6)
  567. ENDP    [<symbol>]    end a PFRAME, symbol is set to size of the frame
  568.  
  569. PFRAME and ENDP allow parameters passed on the stack to subroutines to be 
  570. easily defined. For example, suppose you have a subroutine whose Pascal 
  571. definition is:
  572.  
  573.    FUNCTION  Slush (parm1: LONGINT; parm2: INTEGER; parm3: BOOLEAN) : INTEGER;
  574.  
  575. Then you could code it in McAssembly as follows:
  576.  
  577.             pframe
  578.         result    integer        will have an a6 offset of 16
  579.         parm1    longint        will have an a6 offset of 12
  580.         parm2    integer        will have an a6 offset of 10
  581.         parm3    boolean        will have an a6 offset of 8
  582.             endp    psize    will have a value of 10
  583.  
  584.         Slush    link    a6,#0
  585.             move    parm2,d0    then this is equivalent to
  586.             move    10(a6),d0        to this
  587.             ...
  588.             move    d0,result    returns the result
  589.             unlk    a6
  590.             move.l    (sp)+,a0    get return address
  591.             addi.l    #psize-2,sp    clear parameters (leave result)
  592.             jmp    (a0)        and return
  593.  
  594. Notice that PFRAME automatically allocates space for a stacked return address 
  595. and a stacked linkage register, so you have to do a 'link' instruction on entry 
  596. to the routine if you use PFRAME. The ENDP is optional is you have an LFRAME 
  597. immediately following.
  598.  
  599.  
  600. PRMT    "prompt"        display a prompt on the screen
  601. PRTR    "string"        send ctrl string to printer
  602. PSIZE     <absolute expr>        set listing page size
  603.  
  604. REF     <symbol> [, <symbol>, ...]    reference external symbols
  605. XREF     <symbol> [, <symbol>, ...]     reference external symbols
  606.  
  607. REF and XREF are equivalent and allow you to reference symbols which are 
  608. defined in other modules.
  609.  
  610.  
  611. REQU    Dn | An | <register symbol>    equate symbol to a register
  612.  
  613. For example:
  614.  
  615.         dataptr    requ    a4
  616.             move.l    (dataptr),d0    then this is the same as...
  617.             move.l    (a4),d0            this
  618.         bufptr    equ    dataptr
  619.             move.l    bufptr,d1    and this...
  620.             move.l    a4,d1            is the same as this
  621.  
  622.  
  623. RPATH    "pathname"    specify an HFS path for the .rel object file
  624.  
  625. SET    <expr>        set symbol to value, may be reSET again
  626.  
  627. STRING    <expr>        set DC.B string formats:
  628.                 0 = no length byte prefixes (default)
  629.                 else prefix with length bytes
  630.  
  631. TABS     <n>        specify listing tab stops every <n> columns
  632.  
  633. TCOMP            activate the trap compiler (described later)
  634.  
  635. TERSE            set short listing format (no line numbers, 16 bits of     
  636.             program counter)
  637.  
  638.  
  639. TEXP     <absolute expr>        text expansion control
  640.  
  641. If the expression is 0, then only one line of object bytes appears in the 
  642. listing for a TEXT statement. Otherwise all of the bytes generated by the text 
  643. will appear in the listing.
  644.  
  645. TEXT    [ - | + | # ] "string"        define a text string
  646.  
  647. '-' sets bit 7 on the last byte of the string. '+' sets bit 7 in every string 
  648. byte (Apple ][ forever!). '#' stuffs a length byte in front of the string. 
  649. (Only one prefix is allowed at a time.) You can use the following escape 
  650. characters in the string:
  651.  
  652.         /R    carriage return        $0D
  653.         /L    linefeed        $0A
  654.         /"    double quote        $22
  655.         /T    tab            $09
  656.         /E    escape            $1B
  657.         /0    null            $00
  658.         //    slash            $2F
  659.         /F    formfeed        $0C
  660.         /B    backspace        $08
  661.         /$hh    any hex number        $hh
  662.         /'    single quote        $27
  663.         /D    current date
  664.         /S    select short date form
  665.         /U    select unabbreviated long date form
  666.         /A    select abbreviated long date form (the default)
  667.  
  668. For example:
  669.  
  670.         text    #"ABC"        generates 05 41 42 43
  671.         text    +"ABC"        generates C1 C2 C3
  672.         text    -"ABC"        generates 41 42 C3
  673.         text    "ABC/T/$21/R"    generates 41 42 43 09 21 0D
  674.  
  675.  
  676. TITLE    "string [$] "    specify listing page title, '$' generates a timestamp
  677.  
  678. TRAPW     <absolute expr>    define a trap word
  679. OPWORD    <absolute expr>    define a trap word
  680.  
  681. For example:
  682.  
  683.     _Open    trapw    $A003
  684.         _Open
  685.  
  686. **************************************************************************
  687.             STRING DELIMITERS
  688. **************************************************************************
  689.  
  690.     In all of the above pseudo-op descriptions, strings have been shown 
  691. delimited by double quotes as in "string". However, you may also delimit them 
  692. with single quotes as in 'string'. The only place you can't use single quotes 
  693. as delimiters is in IF comparisons (because then the single quoted item would 
  694. be evaluated as a character constant.)
  695.  
  696. **************************************************************************
  697.             .PSM FILES
  698. **************************************************************************
  699.  
  700.     Packed symbol files are binary files containing only symbol 
  701. definitions. They're smaller in size than their text equivalents. This saves 
  702. disk space and speeds up assembly. They also speed up assembly because they're  
  703. read only on the first pass of the assembly. They're not read on the second 
  704. pass. Packed symbol files have a filename suffix of .PSM.
  705.  
  706.     You can create a file of symbol definitions from any source file. Just 
  707. select the assembler .PSM file option and assemble the file. McAssembly dumps 
  708. all the names of all symbols defined in the file and their values to a .PSM 
  709. file at the end of the assembly.
  710.  
  711.     You use .PSM files by INCLuding them in your source files.
  712.  
  713.     Symbols that are defined in more than one INCLuded .PSM file are not 
  714. flagged as multiply defined symbols. The symbol takes the value of the last 
  715. definition of it processed by McAssembly. This allows you to use .PSM files 
  716. containing overlapping symbol definitions without worrying about multiple 
  717. definitions.
  718.  
  719. **************************************************************************
  720.             THE TRAP COMPILER
  721. **************************************************************************
  722.  
  723.     McAssembly contains a built-in Trap Compiler which allows certain 
  724. toolbox and O/S traps to be invoked with one line of source code. It eliminates 
  725. much of the drudgery from trap setup and interfacing. For brevity, we'll call 
  726. the Trap Compiler simply the TC throughout the rest of this section.
  727.  
  728.     The TC was designed to simplify interfacing to the Macintosh 
  729. stack-based traps. Stack-based traps are those traps which pass parameters and 
  730. return results on the 68000 stack. (As opposed to register-based traps, which 
  731. pass parameters and return results in 68000 registers.) Interfacing to 
  732. stack-based traps requires a standard sequence of steps which are common to all 
  733. such traps: 
  734.  
  735.     1.) If the trap is a function, make room on the stack for the function     
  736.     result.
  737.     2.) Push the parameters on the stack.
  738.     3.) Execute the trap.
  739.     4.) If the trap is a function, remove the function result from the     
  740.     stack.
  741.  
  742. This standard sequence requires a large amount of source code overhead each 
  743. time a trap is called. Not only is this process tedious to code, but it is also 
  744. prone to errors. The purpose of the TC is two-fold: to eliminate the coding 
  745. overhead and to automate the sequence as much as possible in order to eliminate 
  746. coding errors.
  747.  
  748.     The TC is not available for use unless you specifically invoke it by 
  749. using the TCOMP pseudo-op. If you want to use the TC, just specify TCOMP at the 
  750. beginning of your source file. TCOMP loads the symbol table with special highly 
  751. encoded macrox definitions of all the stack-based traps.
  752.  
  753.     Once you've activated the TC with TCOMP, you can then invoke any 
  754. stack-based trap by specifying the name of the trap as an opcode and follow it 
  755. with a list of parameters as operands like this:
  756.  
  757.     TrapName <tab> param1, param2,...,paramn [,=result]
  758.  
  759. Notice that TrapName is not preceded by an underscore character. This allows 
  760. you to bypass the TC and manually invoke all of the traps by using the trap 
  761. name preceded by an underscore.
  762.  
  763.     The list of parameters param1...paramn varies depending on the trap 
  764. you're calling. The parameters in the list correspond exactly to the PASCAL 
  765. definitions of the traps in Inside Macintosh. Some traps don't have any 
  766. parameters, in which case you don't specify any. The contents of the parameters 
  767. you specify are automatically pushed onto the stack for you by the TC. The size 
  768. of the item pushed (byte, word, long) is also automatically taken care of for 
  769. you by the TC.
  770.  
  771.     In some cases, you'll want to use the address of a symbol as a 
  772. parameter instead of its contents. The TC allows you to do that by specifying 
  773. an exclamation point character ! in front of the parameter. Note that ! is only 
  774. allowed on parameters of size long.
  775.  
  776.     The =result item is only used on functions. If the trap returns a 
  777. result on the stack, then it's a function and you have to specify where you 
  778. want the result to be stored. In the case of functions, the TC automatically 
  779. creates room on the stack for the function result before stacking any input 
  780. parameters and pops the result off the stack after the trap returns and stores 
  781. it in the result parameter you specify (again, taking care of sizing 
  782. automatically.) The = before a result item is optional. It's only purpose is to 
  783. improve readability of your code.
  784.  
  785.     All of this may sound complex, but it's really pretty easy to use. 
  786. Examples are a better way to explain it, so...
  787.  
  788. AN EXAMPLE
  789.  
  790.     Here's an example of using the TC. We'll use the Menu Manager trap 
  791. _NewMenu which has a PASCAL definition of:
  792.  
  793.     function NewMenu (menuID:INTEGER; menuTitle:Str255) : MenuHandle
  794.  
  795. Here's a code fragment using this trap:
  796.  
  797.             tcomp            turn on the trap compiler
  798.  
  799.     ourTitle    text    #"Example"    parameters we'll need
  800.     ourMenu    equ    100
  801.             a5sec
  802.     MHandle    ds.l    1
  803.             a5end
  804.  
  805.             NewMenu    #ourMenu,!ourTitle,=MHandle
  806.  
  807. This trap call would be expanded by the TC to the following sequence:
  808.  
  809.             subq.l    #4,sp
  810.             move.w    #ourMenu,-(sp)
  811.             pea    ourTitle,-(sp)
  812.             dc.w    $A931
  813.             move.l    (sp)+,MHandle
  814.  
  815. Notice that in this example we needed the address of the title so we prefixed 
  816. ourTitle with !.
  817.  
  818.     Let's use the same trap for another example. Assume that this time we 
  819. have computed the value of the menu ID and the address of the title string 
  820. dynamically. Assume further that the menu ID is in register D1 and the title 
  821. string address is in A2. We would then invoke the trap as follows:
  822.  
  823.             NewMenu    d1,a2,a0
  824.  
  825. Which would expand to:
  826.  
  827.             subq.l    #4,sp
  828.             move.w    d1,-(sp)
  829.             move.l    a2,-(sp)
  830.             dc.w    $A931
  831.             move.l    (sp)+,a0
  832.  
  833. Notice that this time we didn't specify the = to indicate a function result. 
  834. This is perfectly acceptable but not as readable. Also notice that we stored 
  835. the result in register A0 as opposed to MHandle.
  836.  
  837. A NAMING QUIRK
  838.  
  839.     There are two stack-based traps which have the same names as McAssembly 
  840. opcodes: the QuickDraw traps Move and Line. To avoid conflicts, if you want to 
  841. use the TC on these traps, be aware that they're renamed QDMove and QDLine in 
  842. the TC. You have to use these new names if you want the TC to recognize these 
  843. two traps.
  844.  
  845. WHAT TRAPS AREN'T RECOGNIZED
  846.  
  847.     The trap compiler doesn't contain definitions for the following traps 
  848. (because they're register-based):
  849.  
  850.     Device Manager
  851.     File Manager
  852.     Memory Manager
  853.     OS Event Manager
  854.     OS Utilities
  855.     Segment Loader
  856.  
  857.     In addition, only the following packages are supported:
  858.  
  859.     International
  860.     Standard File
  861.     Disk Initialization
  862.     SCSI Manager
  863.     List Manager
  864.  
  865.     (The trap compiler contains definitions for all of the stack-based Mac+ 
  866. traps for the new 128K ROM.)
  867.  
  868. USING IT WITH .PSM FILES
  869.  
  870.     There are naming conflicts between the names recognized by the TC and 
  871. some equates in the .PSM files. In particular, some "routine selector" equates 
  872. will cause conflicts. For example, SFGetFile is both a legal TC trap name and a 
  873. routine selector equate in the PackMacs.PSM file. If you want to use the TC 
  874. with the .PSM files, then you must activate it after you've included the .PSM 
  875. files!. In other words, don't use TCOMP until after all of your includes. If 
  876. you do this, then the symbols which are in both files will be forced to be trap 
  877. compiler names. The duplicated symbols will no longer be available as equated 
  878. values. Which is what you want, since if you're using the TC, then you won't 
  879. need the routine selector equates.
  880.  
  881. **************************************************************************
  882.             THE RESOURCE COMPILER
  883. **************************************************************************
  884.  
  885.  
  886.     McAssembly contains a built-in Resource Compiler which can assemble 
  887. resource definitions. A two-character resource delimiter at the start of a 
  888. source line identifies resource definitions. The delimiter sequence $$ starts a 
  889. standard resource definition, a definition of a resource type that McAssembly 
  890. knows how to interpret. The delimiter sequence [[ starts a user-defined 
  891. resource definition, a definition of a resource type that McAssembly doesn't 
  892. know how to interpret. The delimiter sequence ]] ends a user defined resource 
  893. definition. Standard resource definitions don't require an ending delimiter 
  894. because McAssembly knows where the resource definition ends from information 
  895. you supply in the definition.
  896.  
  897.     The formats of the two types of definitions are as follows:
  898.  
  899.     $$ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  900.     <item list>
  901.  
  902.     or
  903.  
  904.     [[ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  905.     <code and/or data>
  906.     ]]
  907.  
  908.  
  909.     TYPE is a four-character resource type. For standard definitions, it 
  910. must be one that McAssembly recognizes. For a user-defined definition, it can 
  911. be any four characters. ID is the resource ID number. ATTR specifies the 
  912. attribute byte for the resource. NAME is the name string of the resource. ATTR 
  913. and NAME are optional parameters and may be omitted, although you can't omit 
  914. the ATTR if you want to specify a NAME. Here are two examples for a standard 
  915. resource, one with all parameters specified, and one with ATTR and NAME 
  916. omitted:
  917.  
  918.     $$ ALRT, 2, 0, alert no. 2
  919.  
  920.     $$ WIND, 1
  921.  
  922.     The item list is simply a list of items that make up the resource 
  923. definition. McAssembly interprets each item in the list in a certain way. The 
  924. types of items you specify in the list must correspond exactly with the types 
  925. of items that McAssembly expects for that resource. If you specify an item of 
  926. the wrong type or if you specify too many or too few items, you'll get syntax 
  927. errors (many) on subsequent lines of the file. 
  928.  
  929.     Items in the item list appear at the beginning of subsequent source 
  930. lines after the line containing the $$. The format of lines in the item list is 
  931. as follows:
  932.  
  933.     item [, item, ...] [<tab>] [;] [comment]
  934.     item [, item, ...] [<tab>] [;] [comment]
  935.     etc... for as many lines as it takes to specify all items
  936.  
  937. As you can see, you have your choice of entering each item on its own source 
  938. line, or of placing several items on one line, or a combination of either. 
  939. McAssembly ignores all subsequent characters on the line after a tab or ; 
  940. character and skips to the start of the next line for the next item in the 
  941. list.
  942.  
  943.     There are several types of items. The type of each is marked in the 
  944. descriptions of the formats for each standard resource. These types have the 
  945. following meanings:
  946.  
  947.     bexp    an expression interpreted as a byte
  948.     wexp    an expression interpreted as a word
  949.     lexp    an expression interpreted as a long
  950.     chrl    a four-character long
  951.     str    a string
  952.  
  953.     bexp, wexp, and lexp items are numeric expressions and can be any legal 
  954. McAssembly expression. In most cases, you don't have to worry about what size 
  955. the expression is. In some cases you do, particularly in the bit maps, which 
  956. McAssembly interprets as a sequence of longwords.
  957.  
  958.     Enter chrl items as a sequence of from one to four characters. If you 
  959. specify fewer than four characters, then the item is left justified in a 32-bit 
  960. long and padded on the right with spaces. Don't enclose the characters in 
  961. quotation marks.
  962.  
  963.     You may enter strings in either of two ways. First, if your string 
  964. contains no special characters or leading spaces you can just type the string. 
  965. If it does contain special characters or leading spaces, you must enclose the 
  966. string in quotation marks as "string".  (Any of the escape sequences allowed in 
  967. TEXT strings are allowed in string.) If your string isn't enclosed in quotation 
  968. marks, then you can continue the string to the start of the next line by ending 
  969. the string with a \ character. Strings enclosed in quotes can't be continued to 
  970. the next line. You can specify a null string (a string with a length of zero) 
  971. with the vertical bar |.
  972.  
  973.     The code and/or data in a user-defined resource may be any combination 
  974. of legal McAssembly instruction opcodes or pseudo-ops. The definition must end 
  975. with the ]] delimiter or you'll get an error message.
  976.  
  977. STANDARD RESOURCE FORMATS
  978.  
  979.     What follows is a list of the standard resource types that McAssembly 
  980. recognizes and the formats of the item lists for each. Each item in these 
  981. formats appears on its own source line but that doesn't have to be the case. 
  982. They're only shown that way here for clarity.
  983.  
  984. ----------------------------------------------------------------------------
  985.  
  986. $$ ALRT,ID,ATTR,NAME
  987. TOP        wexp    bounds rectangle:
  988. LEFT        wexp
  989. BOTTOM        wexp
  990. RIGHT        wexp
  991. DITL_LIST_ID    wexp    resc ID of item list
  992. STAGES        wexp    see DLOG Mgr, IM, page 35
  993.  
  994. ----------------------------------------------------------------------------
  995.  
  996. $$ BNDL,ID,ATTR,NAME
  997. SIGNATURE        chrl    application's signature
  998. VERS_DATA_RESC_ID    wexp    0 by convention
  999. NO_RESC_TYPES        wexp    no. of BNDL resc types that follow:
  1000.  
  1001. For each resc type:
  1002. RESOURCE_TYPE        chrl    typically ICN# or FREF
  1003. NO_MAPPINGS_THIS_TYPE    wexp    no. of mappings that follow:
  1004.  
  1005. For each mapping:
  1006. LOCAL_ID    wexp
  1007. ACTUAL_ID    wexp
  1008.  
  1009.  
  1010. ** Note: If you use the standard BNDL resource in a module, then McAssembly
  1011. automatically sets the bundle bit in the output file after the link is 
  1012. completed.
  1013.  
  1014. ----------------------------------------------------------------------------
  1015.  
  1016. $$ CNTL,ID,ATTR,NAME
  1017. TOP            wexp    bounds rectangle:
  1018. LEFT            wexp
  1019. BOTTOM            wexp
  1020. RIGHT            wexp
  1021. INITIAL_VALUE        wexp    current value of control
  1022. VISIBLE            wexp    boolean
  1023. MAX_VALUE        wexp    maximum value of control
  1024. MIN_VALUE        wexp    minimum value of control
  1025. CTRL_DEFINITION_ID    wexp    resc ID of the definition function for
  1026.                        the control type:
  1027.                         0  simple button
  1028.                         1  check box
  1029.                         2  radio button
  1030.                         8  add to use window's font
  1031.                         16 scroll bar
  1032. REFCON            lexp    user defined value
  1033. TITLE            str    the control's title
  1034.  
  1035. ----------------------------------------------------------------------------
  1036.  
  1037. $$ CURS,ID,ATTR,NAME
  1038. CURSOR_DATA_BYTES    lexp    eight longs of cursor image:
  1039.    "    lexp
  1040.    "     lexp
  1041.    "     lexp
  1042.    "     lexp
  1043.    "     lexp
  1044.    "     lexp
  1045.    "     lexp
  1046. CURSOR_MASK_BYTES    lexp    eight longs of cursor mask:
  1047.    "     lexp
  1048.    "     lexp
  1049.    "     lexp
  1050.    "     lexp
  1051.    "     lexp
  1052.    "     lexp
  1053.    "     lexp
  1054. H_OF_HOT_SPOT        wexp    horizontal of the hot spot
  1055. V_OF_HOT_SPOT        wexp    vertical of the hot spot
  1056.  
  1057. ----------------------------------------------------------------------------
  1058.  
  1059. $$ DITL,ID,ATTR,NAME
  1060. NO_ITEMS_IN_LIST    wexp    no. of items in this list:
  1061.  
  1062. For each item in the list:
  1063. HANDLE_HOLDER        lexp    placeholder for handle or pointer - normally 0
  1064. TOP            wexp    display rectangle (local coordinates):
  1065. LEFT            wexp
  1066. BOTTOM            wexp
  1067. RIGHT            wexp
  1068. ITEM_TYPE        bexp    type of the item:
  1069.                     0   user defined (dialog only)
  1070.                     4   std button control
  1071.                     5   std check box control
  1072.                     6   std radio button control
  1073.                     7   defined in CTRL template
  1074.                     8   static text
  1075.                     16  editable text (dialog only)
  1076.                     32  icon
  1077.                     64  QuickDraw picture
  1078.                     128 add to any of above to disable
  1079. ITEM    ----            the actual item; contents of this field
  1080.                 depend on item type as follows:
  1081.                 If item type is, then content is:
  1082.                    4,5,6    str    control title
  1083.                    7    wexp    resc ID of template
  1084.                    8,16    str    the text
  1085.                    32,64    wexp    resc ID of ICON or PICT
  1086.                     0    nil    empty (length = 0)
  1087.  
  1088. ----------------------------------------------------------------------------
  1089.  
  1090. $$ DLOG,ID,ATTR,NAME
  1091. TOP            wexp    bounds rectangle:
  1092. LEFT            wexp
  1093. BOTTOM            wexp
  1094. RIGHT            wexp
  1095. WINDOW_DEFINITION_ID    wexp    the type of window:
  1096.                     0  std doc wind or modeless dialog box
  1097.                     1  alert box or modal dialog box
  1098.                     2  plain box
  1099.                     3  plain box with shadow
  1100.                     4  doc window without size box
  1101.                     16 rounded corner window
  1102. VISIBLE            wexp    boolean, initial state of dialog
  1103. GOAWAY            wexp    boolean, TRUE means window has a close box
  1104. REFCON            lexp    user defined value
  1105. RESC_ID_OF_ITEM_LIST    wexp    resc ID of the DITL for this dialog
  1106. TITLE            str    the dialog's title (0 length string if modal     
  1107.                 dialog box)
  1108.  
  1109. ----------------------------------------------------------------------------
  1110.  
  1111. $$ FREF,ID,ATTR,NAME
  1112. FILETYPE        chrl    typically APPL
  1113. LOCAL_ID_FOR_ICON_LIST    wexp
  1114. FILENAME        str    filename that should follow the file
  1115.                         to a new disk (null string if none) 
  1116.  
  1117. ----------------------------------------------------------------------------
  1118.  
  1119. $$ ICON,ID,ATTR,NAME
  1120. (32) ICON_BYTE_LONGS    lexp    icon bit map - 32 longs:
  1121. ...
  1122. ...
  1123.  
  1124. ----------------------------------------------------------------------------
  1125.  
  1126. $$ ICN#,ID,ATTR,NAME
  1127. (32) ICON1_BYTE_LONGS    lexp    icon bit map - 32 longs:
  1128. ...
  1129. ...
  1130. (32) ICON2_BYTE_LONGS    lexp    icon bit map mask - 32 longs:
  1131. ...
  1132. ...
  1133.  
  1134. ----------------------------------------------------------------------------
  1135.  
  1136. $$ MENU,ID,ATTR,NAME
  1137. WIDTH_HOLDER        wexp    0 - placeholder for menu width
  1138. HEIGHT_HOLDER        wexp    0 - placeholder for menu height
  1139. STD_MENU_PROC_HOLDER    lexp    normally 0
  1140. ENABLE_MASK        lexp    bit 0 set if menu enabled,
  1141.                   bit 1 set if menu item 1 enabled,
  1142.                   bit 2 set if menu item 2 enabled,
  1143.                   etc...
  1144. MENU_TITLE        str    the menu's title
  1145. NUMBER_MENU_ITEMS    wexp    number of items in the menu:
  1146.  
  1147. For each menu item:
  1148. MENU_ITEM        str    the text of the item
  1149. ICON_NUMBER        bexp    0 = none, ICON'S resc ID = ICON number + 256
  1150. KEYBD_EQUIV        bexp    equivalent kybd char code, 0 = none
  1151. MARKING_CHAR        bexp    marking char code, 0 = no mark
  1152. TEXT_STYLE        bexp    text style of the item:
  1153.                     bit 0 = bold
  1154.                     bit 1 = italic
  1155.                     bit 2 = underline
  1156.                     bit 3 = outline
  1157.                     bit 4 = shadow
  1158.                     bit 5 = condense
  1159.                     bit 6 = extend
  1160.  
  1161. ----------------------------------------------------------------------------
  1162.  
  1163. $$ PAT ,ID,ATTR,NAME
  1164. PATTERN_BYTES    lexp    two longs:
  1165.    "        lexp
  1166.  
  1167. ----------------------------------------------------------------------------
  1168.  
  1169. $$ PAT#,ID,ATTR,NAME
  1170. NO_OF_PATTERNS        wexp    the number of patterns in the list:
  1171.  
  1172. For each pattern:
  1173. PATTERN_BYTES        lexp    two longs:
  1174.    "            lexp
  1175.  
  1176. ----------------------------------------------------------------------------
  1177.  
  1178. $$ STR ,ID,ATTR,NAME
  1179. STRING            str
  1180.  
  1181. ----------------------------------------------------------------------------
  1182.  
  1183. $$ STR#,ID,ATTR,NAME
  1184. NO_OF_STRINGS        wexp    the number of strings in the list:
  1185.  
  1186. For each string:
  1187. STRING            str
  1188.  
  1189. ----------------------------------------------------------------------------
  1190.  
  1191. $$ WIND,ID,ATTR,NAME
  1192. TOP            wexp    bounds rectangle:
  1193. LEFT            wexp
  1194. BOTTOM            wexp
  1195. RIGHT            wexp
  1196. WINDOW_DEFINITION_ID    wexp    window type:
  1197.                     0  std doc window or modeless dialog     
  1198.                     box
  1199.                     1  alert box or modal dialog box
  1200.                     2  plain box
  1201.                     3  plain box with shadow
  1202.                     4  doc window without size box
  1203.                     16 rounded corner window
  1204. VISIBLE            wexp    boolean, initial state of window
  1205. GOAWAY            wexp    boolean, TRUE means window has a close box
  1206. REFCON            lexp    user defined value
  1207. TITLE            str    the window's title
  1208.  
  1209. ----------------------------------------------------------------------------
  1210.  
  1211. [[ XXXX,ID,ATTR,NAME    user defined resource
  1212. <DATA/CODE>        whatever you want
  1213. ...
  1214. ]]            don't forget the ender!
  1215.  
  1216. ----------------------------------------------------------------------------
  1217.  
  1218. **************************************************************************
  1219.             LINKING
  1220. **************************************************************************
  1221.  
  1222.     McLink is the linker portion of the McAssembly program. McLink links 
  1223. together .REL files produced by McAssembly and stores the result in a resource 
  1224. file. Depending on the contents of the .REL files, the resulting resource file 
  1225. is either a pure resource file or an executable application.
  1226.  
  1227.     (McAssembly can't link object files which are in the MDS or MPW 
  1228. formats. The reverse is also true. However, McAssembly can generate MPW format 
  1229. object files, and a utility is provided to those who register that will convert 
  1230. McAssembly object files to MDS object files.)
  1231.  
  1232.     The file you specify to McLink is actually a link specification file. 
  1233. It contains the names of the files to be linked and the name of the resulting 
  1234. output file. The specification file has the following format (each filename is 
  1235. on a separate line):
  1236.  
  1237.     input .REL filename 1
  1238.     input .REL filename 2
  1239.     ...
  1240.     % input resource filename n
  1241.     % input resource filename n+1
  1242.     ...
  1243.     * lines starting with an asterisk are comments and are ignored
  1244.     ...
  1245.     * lines starting with an '@' are path specifiers - they specify an HFS
  1246.     *     path to use to access all subsequent files
  1247.     @ pathname
  1248.     ...
  1249.     /output filename
  1250.  
  1251. The input files must be either McAssembly .REL files or resource files. The % 
  1252. character must be the first character of lines containing resource filenames to 
  1253. differentiate them from .REL files. If an input filename doesn't end in .REL 
  1254. and it's not a resource file, McLink adds .REL to the name before it tries to 
  1255. open the file. The output filename must be the last filename in the list and 
  1256. must be preceded by a slash character.
  1257.  
  1258.     Resource files are handled as follows: McLink copies all resources in 
  1259. the resource file to the linked output file. If a resource in the resource file 
  1260. is the same as a resource defined in a .REL file, the resource file copy will 
  1261. replace the .REL file copy in the output file. If a BNDL resource is copied, 
  1262. the output file's bundle bit is set.
  1263.  
  1264.     There are only two aspects of ordering that you must follow: 1.) the 
  1265. first data item in the first file that's linked must be the starting 
  1266. instruction of the program, and 2.) all resources must be linked after all code 
  1267. and/or data. If you attempt to link code after a resource has been linked you 
  1268. get an error message.
  1269.  
  1270. **************************************************************************
  1271.             SEGMENTING
  1272. **************************************************************************
  1273.  
  1274.     McAssembly lets you divide up your application into segments. To 
  1275. implement segmenting, you have to do two things: 1.) specify what routines in a 
  1276. particular module may be called from other segments, and 2.) specify the 
  1277. partitioning of the code into segments, i.e., what modules are in what 
  1278. segments. Item 1 is accomplished through the use of the JTBL pseudo-op and 
  1279. allows McLink to construct the jump table containing an entry for every 
  1280. cross-segment accessible routine. Item 2 is accomplished by a SEGMENT COMMAND 
  1281. LINE in your link specification file and tells McLink how to break up the code 
  1282. into segments. The JTBL pseudo-op is described earlier and the segment command 
  1283. line description follows.
  1284.  
  1285.     The Segment Command Line is a special command line in the link 
  1286. specification file. It has the following syntax:
  1287.  
  1288.     $ [P] [L]
  1289.  
  1290. The $ character tells the linker that this line is not the name of a file to be 
  1291. linked but is the start of a new segment. The segment command line writes all 
  1292. modules linked so far to the output file as one segment and groups all 
  1293. subsequent modules (until another segment command line) into a new segment. The 
  1294. P and L parameters specify the attributes of the new code segment. P specifies 
  1295. that the segment is to be "preloaded" and L specifies that the segment is to be 
  1296. "locked." The default for both of these parameters is "not preloaded" and "not 
  1297. locked." (Don't specify a segment command line for the first segment. McLink 
  1298. defaults the attributes for segment number one to "preloaded," "locked," and 
  1299. "purgeable.")
  1300.  
  1301.     Here's an example link specification file for an application that 
  1302. contains four code segments:
  1303.  
  1304.     MAIN
  1305.     $
  1306.     SEG2A
  1307.     SEG2B
  1308.     $ P
  1309.     SEG3
  1310.     $ L P
  1311.     SEG4
  1312.     /MAIN.APPL
  1313.  
  1314. In this example, MAIN is in segment one, SEG2A and SEG2B in segment two, SEG3 
  1315. in segment three, and SEG4 in segment four. All segments are purgeable; 
  1316. segments one, three and four are to be preloaded; and segments one and four are 
  1317. locked. The resulting application program is placed in the file MAIN.APPL.
  1318.  
  1319. **************************************************************************
  1320.             JOB FILES
  1321. **************************************************************************
  1322.  
  1323.     The File menu Run job choice in McAssembly operates on a Job 
  1324. Specification File. A job specification file contains a list of filenames to be 
  1325. assembled and linked to form an output file. By using a job specification file, 
  1326. you eliminate assembling each file separately and invoking the linker to link 
  1327. them.
  1328.  
  1329.     The format of a job specification file is a link specification file 
  1330. whose filenames have no suffixes (.ASM or .REL). In fact, a job specification 
  1331. file can be used as a link specification file, providing it specifies an output 
  1332. file in its last filename line. Here's an example of a job specification file:
  1333.  
  1334.     * This is a comment line
  1335.     * Assemble the file X.ASM if necessary:
  1336.     X
  1337.     * Assemble the file Y.ASM if necessary:
  1338.     Y
  1339.     * Assemble the file Z.ASM if necessary:
  1340.     Z
  1341.     * Put the linked X.REL, Y.REL and Z.REL files into the
  1342.     *    output file XYZ:
  1343.     /XYZ
  1344.  
  1345.     To understand what the job control manager does for this file, 
  1346. understand first that a job is run in two phases, an assembly phase and a link 
  1347. phase. The assembly phase assembles the files and the link phase links the 
  1348. resulting .REL files.
  1349.  
  1350.     During the assembly phase, the job control manager ignores any line in 
  1351. the specification file which starts with any of the characters *, $, or / or 
  1352. which is a blank line. These are comment lines and link control lines which 
  1353. have no meaning in assembly. Any other lines are assumed to contain a 
  1354. non-suffixed filename which is a candidate for assembly. For example, the first 
  1355. thing the job control manager does for this job file is to skip the first two 
  1356. lines because they're comment lines. It then operates on the line X. The job 
  1357. control manager looks to see if X.ASM is on the disk. Let's assume for the 
  1358. purposes of this example that X.ASM isn't on the disk. In this case, the job 
  1359. control manager assumes that X.REL exists and that you don't want to reassemble 
  1360. it. So the specification file line containing X is ignored.
  1361.  
  1362.     The next line is examined similarly. Let's assume the converse here - 
  1363. that Y.ASM does exist. The job control manager assembles Y.ASM if either one of 
  1364. the following two conditions is met: 1.) there is no Y.REL file on the disk, or 
  1365. 2.) the existing copy of Y.REL is out-of-date. (It's out-of-date if the 
  1366. modification date of Y.REL is earlier in time than the modification date of 
  1367. Y.ASM.) In either of these two cases, Y.ASM is assembled, creating a new copy 
  1368. of Y.REL. If Y.REL is up-to-date, then the specification line containing Y is 
  1369. skipped and no assembly is performed.
  1370.  
  1371.     Having disposed of the Y file line, the job control manager goes on to 
  1372. the Z file line. A similar analysis goes on as above and Z.ASM is assembled if 
  1373. necessary.
  1374.  
  1375.     Finally, the last line, /XYZ, is examined. The job control manager 
  1376. recognizes this as an output file specification line for the linker, so the 
  1377. linker is invoked. This ends the assembly phase of the job and begins the link 
  1378. phase.
  1379.  
  1380.     In the link phase, the linker links the files using the job 
  1381. specification file as the link specification file. After the link is complete, 
  1382. the job is done and control returns to the top level of McAssembly.
  1383.  
  1384.     If the /XYZ line doesn't exist in the job file, then the job control 
  1385. manager assumes that no link is desired and skips the linker phase of the job. 
  1386. This allows you to use job files for just assemblies.
  1387.  
  1388. **************************************************************************
  1389.             FILE SUFFIXES
  1390. **************************************************************************
  1391.  
  1392.     McAssembly requires certain suffixes on filenames as follows: (These 
  1393. can be in any combination of upper or lower case.)
  1394.  
  1395.     .asm    assembler source files
  1396.     .rel    assembler object files
  1397.     .lst    assembler listing files
  1398.     .psm    assembler packed symbol files
  1399.     .lnk    link specification file
  1400.     .job    job specification file or link specification file
  1401.     .map    linker listing output file
  1402.     .sym    binary symbol table output by the linker for use by McBug
  1403.  
  1404. **************************************************************************
  1405.             MPW FORMAT
  1406. **************************************************************************
  1407.  
  1408.     McAssembly can create object files in the MPW format. The linker can't 
  1409. link them, but you can link them with the MPW linker. MPW object files will 
  1410. have the suffix '.o.' as opposed to the normal '.rel'.
  1411.  
  1412.     There are two special assembler pseudo-ops in MPW mode. You can use 
  1413. them in normal McAssembly mode, but they'll have no effect on the output files. 
  1414. These pseudo-ops and their descriptions are: 
  1415.  
  1416.     MAIN
  1417.  
  1418.     Identifies a module as being the main code and data module in the 
  1419. application. This causes two things to happen: 1.) The first instruction in the 
  1420. module will be the first instruction executed when the resulting linked 
  1421. application is executed, and 2.) Any A5SEC data in the module is guaranteed to 
  1422. be located immediately below A5. (This data placement is discussed in more 
  1423. detail below.)
  1424.  
  1425.     (In McAssembly, a "module" is equivalent to a source file. This is 
  1426. different than the MPW definition of a module, which allows any number of 
  1427. modules to be contained in one source file.)
  1428.  
  1429.     SEG    ["<segment name>"]
  1430.  
  1431.     Allows you to control the segmentation of your program. Only the last 
  1432. seg statement in a source file is effective. It causes all of the code 
  1433. generated by that file to be placed in a segment named segment name. Code which 
  1434. resides in any particular segment doesn't have to be linked consecutively - the 
  1435. MPW linker figures out what goes where and collects all segment code together 
  1436. regardless of what order the files are linked in. If you don't use a seg 
  1437. statement in a file or use a seg without a segment name then all of the code in 
  1438. the file is placed in a segment named Main by the  linker.
  1439.  
  1440.     (Again, this is slightly different than the MPW convention, which 
  1441. allows code in any one source file to be placed into any number of segments.)
  1442.  
  1443. RESTRICTIONS
  1444.  
  1445.     Just as there are some things you can do in the MPW assembler that you 
  1446. can't do in McAssembly, there are also some McAssembly features that can't be 
  1447. implemented with the MPW object format. Here's what you can't do in MPW mode:
  1448.  
  1449.     1.) The pseudo-ops A5OFF, FSIGN, and FTYPE are illegal in MPW mode.
  1450.  
  1451.     2.) None of the resource compiling capabilities can be used.
  1452.  
  1453.     3.) In McAssembly, you can branch to an externally defined symbol using 
  1454. the Bcc, BSR, and DBcc instructions. You can't do that in MPW. You have to use 
  1455. equivalent JSR and JMP instructions instead.
  1456.  
  1457. A5 DATA STORAGE
  1458.  
  1459.     The MPW linker has a slightly different perspective of A5 data 
  1460. allocation than MDS had - it's entirely under your control. This means that the 
  1461. linker has no provisions for allowing for the usual $100 bytes of QuickDraw 
  1462. global storage on top of your own A5 data. If your programs rely on this (and 
  1463. they do if they do an InitGraf !-4(A5) when they start up!), then you have to 
  1464. allocate this area specifically yourself. You can do it very simply like this
  1465.  
  1466.         a5sec
  1467.     <your own global variable definitions>
  1468.         ds.b    grafSize    QuickDraw's space
  1469.         a5end
  1470.  
  1471. but there are two important restrictions for this to work properly:
  1472.  
  1473.     1.) The grafSize bytes of A5 storage must be defined in the main module 
  1474. (the source file containing the main pseudo-op.) If it's not in the main 
  1475. module, then the linker will not necessarily place it immediately below A5.
  1476.  
  1477.     2.) The grafSize bytes of A5 storage must be the last A5 storage item 
  1478. defined in the main module. In other words, if you have several A5SEC's in your 
  1479. main file, then make sure that the grafSize bytes are the last A5SEC item in 
  1480. the file. (This is because McAssembly allocates A5 variables in reverse order 
  1481. of how they appear in the file - the first A5 variable is the lowest in memory, 
  1482. and the last is highest in memory.)
  1483.  
  1484.     (Notice that grafSize, which is defined in the QuickEqu system file, is 
  1485. only $CE bytes, not $100. GrafSize is all that's actually required. I think the 
  1486. $100 was just used for historical reasons as an arbitrarily large enough 
  1487. number.)
  1488.  
  1489. **************************************************************************
  1490.             USER-DEFINABLE .MAP FILES
  1491. **************************************************************************
  1492.  
  1493.     The McAssembly linker menu contains an option to save link .MAP files 
  1494. in a user-definable format. This is accomplished by the use of a resource 
  1495. containing the user-supplied formatting code. This resource is type UMAP, ID 
  1496. 128. If a .MAP file has been requested, and if the user .MAP file format is 
  1497. selected, then the linker communicates with the UMAP resource code to 
  1498. accomplish the writing of symbol table information to the .MAP file.
  1499.  
  1500.     The default user .MAP file format is an enhanced MDS format, and has 
  1501. been designed to work with Steve Jasik's debugger. It should probably also work 
  1502. with TMON. The source code for the UMAP resource is provided to all registered 
  1503. users so it can easily be modified to support other .MAP formats.
  1504.  
  1505. **************************************************************************
  1506.             CONFIGURATION RESOURCES
  1507. **************************************************************************
  1508.  
  1509.     The following resources affect McAssembly's operation, and may be 
  1510. changed to whatever you like:
  1511.  
  1512. STR,128    =    The four-character creator string for all text files created
  1513.         by McAssembly. For example, change this to 'QED1' if you use
  1514.         the QUED editor.
  1515.  
  1516. STR,129 =    A string which is sent to the printer before every print job.
  1517.         Change this to whatever your printer likes to see.
  1518.